﻿using Kw.Combinatorics;
using System;

namespace Kw.CombinatoricsExamples
{
    // Subclassing is one way to get user-friendly output.
    public class Numbers : Permutation
    {
        static string[] names = new string[] { "one", "two", "three" };

        public Numbers () : base (names.Length)
        { }

        public override string ToString ()
        {
            string result = "";
            foreach (int element in this)
                result += names[element] + " ";
            return result;
        }
    }

    class PermutationExample02
    {
        static void Main ()
        {
            foreach (Permutation row in new Numbers().GetRowsForAllWidths())
                Console.WriteLine (row);
        }

        /* Output:

        one
        one two
        two one
        one two three
        one three two
        two one three
        two three one
        three one two
        three two one

        */
    }
}
